#![cfg_attr(
    all(not(debug_assertions), target_os = "windows"),
    windows_subsystem = "windows"
)]

#[tauri::command]
fn time() -> String {
    
    let address = "0.pool.ntp.org:123";
    match ntp::request(address) {
        Ok(response)=>{
            response.transmit_time.to_string()
        },
        Err(_)=>{
            "同步失败".to_string()
        }
    }
}
fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![time])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
